package cn.com.utt.unms.controller;

import java.security.Principal;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import cn.com.utt.common.vo.RestResult;
import cn.com.utt.unms.service.ClientService;
import cn.com.utt.unms.vo.GraphQueryResponse;

@RestController
@RequestMapping("/v1/clients")
public class ClientController {
	@Autowired
	private ClientService clientService;
	
	/*
	 * /searchByGroup/1/history?start=133999990&end=1938339339
	 */
	@RequestMapping(value = "/searchByGroup/{networkId}/history", method = { RequestMethod.GET })
	public Map<String, Object> searchHistoryByGroup(@PathVariable Long networkId,Long start,Long end,Principal principal) {
		RestResult result = new RestResult();
		List<GraphQueryResponse> resps = clientService.queryHistoryByNetwork(networkId, start/1000, end/1000);
		result.put("datas", resps);
		return result.toJsonObject();
	}
	
}
